package com.felight.set;

/**
 * Student class which overrides hashcode and equals method are created.
 * 
 * @author soumya
 * 
 */
public class Student {
	public String name;
	public int perc;

	Student(String name, int perc) {
		this.name = name;
		this.perc = perc;
	}

	@Override
	// returns the length of the name as hashcode.
	public int hashCode() {
		return name.length();
	}

	@Override
	// equals() method checks whether the perc are equal or not.
	public boolean equals(Object obj) {
		if (obj instanceof Student) {
			Student s = (Student) obj;
			if (this.perc == s.perc) {
				return true;
			} else
				return false;
		} else {
			return false;
		}
	}
}
